//
// Created by guanzhe on 16/1/3.
// Copyright (c) 2016 BMProject. All rights reserved.
//

#import "MsgSendPerCell.h"
#import "DataModel.h"

@interface MsgSendPerCell (){
    MsgReceiveModel *_model;
}

@property (weak, nonatomic) IBOutlet UIImageView *selectIv;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@end

@implementation MsgSendPerCell {

}

- (void)setCellInfo:(NSArray *)infoArr andPosition:(NSInteger)position {
    [super setCellInfo:infoArr andPosition:position];
    MsgReceiveModel *msgReceiveModel = [infoArr objectAtIndex:position];
    _model = msgReceiveModel;
    if(msgReceiveModel.isSelected){
        self.selectIv.image = [UIImage imageNamed:@"circle_sel@3x.png"];
    } else{
        self.selectIv.image = [UIImage imageNamed:@"promiseCircle"];
    }
    [self.selectIv setUserInteractionEnabled:YES];
    [self.nameLabel setUserInteractionEnabled:YES];
    [self.selectIv addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(selectAction)]];
    [self.nameLabel addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(selectAction)]];
    self.nameLabel.text = [NSString stringWithFormat:@"%@%@%@%@",msgReceiveModel.name,@"(",msgReceiveModel.storeName,@")"];

}

- (void)selectAction{
    [self.delegate clickActionWithData:_model];
}


@end